﻿@model GPI.Models.GPI_PERIOD

@{
    ViewBag.Title = "Modifier Date";
}
<script src="@Url.Content("~/Scripts/jquery.validate.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery-1.5.1.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery-ui-1.8.11.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/EditorHookup.js")" type="text/javascript"></script>
<script src="/Scripts/MicrosoftAjax.js" type="text/javascript"></script>
<script src="/Scripts/MicrosoftMvcValidation.js" type="text/javascript"></script>

@using (Html.BeginForm(null, null, FormMethod.Post, new { id = "dateFrom" }))
{
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>Période d'inscription</legend>

        <div class="editor-label">
            @Html.LabelFor(model => model.start_date)
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(model => model.start_date, new { @class = "date", @Value = @String.Format("{0:dd.MM.yyyy}", Model.start_date) })
            @Html.ValidationMessageFor(model => model.start_date)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.end_date)
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(model => model.end_date, new { @class = "date endDate", @Value = @String.Format("{0:dd.MM.yyyy}", Model.end_date) })
            @Html.ValidationMessageFor(model => model.end_date)
        </div>

        <p>
            <input type="submit" value="Enregistrer" />
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink("Retour", "Index")
</div>

<script type="text/javascript">
    $(document).ready(function () {
        //$('.date').datepicker({ dateFormat: 'dd.mm.yy', regional: "fr", minDate: 0 }).attr("readonly", "readonly");
        $('#start_date').datepicker({ dateFormat: 'dd.mm.yy', regional: "fr", minDate: 0, 
            onSelect: function (selected) {
                $("#end_date").datepicker("option", "minDate", selected);
            }
        }).attr("readonly", "readonly");
        $('#end_date').datepicker({ dateFormat: 'dd.mm.yy', regional: "fr", minDate: 0,
            onSelect: function (selected) {
                $("#start_date").datepicker("option", "maxDate", selected);
            }
         }).attr("readonly", "readonly");
    });
</script>